# Maintainer: David Runge <dvzrv@archlinux.org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>

_name=cbor2
pkgname=python-cbor2
pkgver=5.4.6
pkgrel=2
pkgdesc="Pure Python CBOR (de)serializer with extensive tag support"
arch=(loong64 x86_64)
url="https://github.com/agronholm/cbor2"
license=(MIT)
depends=(python)
makedepends=(python-build python-installer python-setuptools-scm python-toml python-wheel)
checkdepends=(python-pytest)
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
sha256sums=('b893500db0fe033e570c3adc956af6eefc57e280026bd2d86fd53da9f1e594d7')
b2sums=('df24c786f32819f9a93a2db28536b78349db6185108188d0a20e7298ff8c083d1feb59110865b4e21190e0363b113201ccddaa0d36b49bd7bbacf9d5ee7695f4')

build() {
  cd $_name-$pkgver
  python -m build -wn
}

check() {
  cd $_name-$pkgver
  export PYTHONPATH="build:${PYTHONPATH}"
  pytest -v -c /dev/null tests
}

package() {
  cd $_name-$pkgver
  python -m installer -d "$pkgdir" dist/*.whl
  install -vDm 644 README.rst -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 LICENSE.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
}
